package com.db.pck.controller;

import com.db.core.vo.R;
import com.db.pck.entity.PackageTenantPerms;
import com.db.pck.service.PackageTenantPermsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 作者：Bin
 * 时间：2023/11/1
 * 描述：键盘敲烂，薪资过万
 */
@RestController
@RequestMapping("pckPermit")
@CrossOrigin
public class PackageTenantPermsController {

    @Autowired
    private PackageTenantPermsService packageTenantPermsService;

    @GetMapping("all")
    public R all(){
        return R.ok(packageTenantPermsService.list(),"success");
    }

    @PostMapping("add")
    public R add(@RequestBody PackageTenantPerms packageTenantPerms){
        return packageTenantPermsService.insert(packageTenantPerms);
    }

    @PostMapping("edit")
    public R edit(@RequestBody PackageTenantPerms packageTenantPerms){
        return packageTenantPermsService.update(packageTenantPerms);
    }

    @GetMapping("delete/{pckPermId}")
    public R delete(@PathVariable Integer pckPermId){
        return packageTenantPermsService.deleteById(pckPermId);
    }
}
